################################################################################
# MAKEFILE for CLogo
# By cpy.prefers.you@gmail.com
################################################################################

OBJS := src/buildin_commands.o src/clogo.o src/error_handling.o src/lexer.o src/parser.o src/symbol_table.o
RM := rm -rf

.PHONY: all clean 

all: clogo

clogo: $(OBJS) 
	@echo 'Building target: $@'
	@echo 'Invoking: GCC C Linker'
	gcc  -o clogo $(OBJS) 
	@echo 'Finished building target: $@'
	@echo ' '

src/buildin_commands.o: src/buildin_commands.c src/buildin_commands.h src/error_handling.h src/clogo.h src/lexer.h src/parser.h
	@echo 'Building target: $@'
	@echo 'Invoking: GCC C Compiler'
	gcc -o src/buildin_commands.o -c src/buildin_commands.c
	@echo 'Finished building target: $@'
	@echo ' '
	
src/clogo.o: src/clogo.c src/clogo.h src/buildin_commands.h src/symbol_table.h src/error_handling.h src/lexer.h src/parser.h
	@echo 'Building target: $@'
	@echo 'Invoking: GCC C Compiler'
	gcc -o src/clogo.o -c src/clogo.c 	
	
src/error_handling.o: src/error_handling.c src/clogo.h src/symbol_table.h src/error_handling.h src/lexer.h
	@echo 'Building target: $@'
	@echo 'Invoking: GCC C Compiler'
	gcc -o src/error_handling.o -c src/error_handling.c
	@echo 'Finished building target: $@'
	@echo ' '
	
src/lexer.o: src/lexer.c src/lexer.h src/clogo.h src/buildin_commands.h src/symbol_table.h
	@echo 'Building target: $@'
	@echo 'Invoking: GCC C Compiler'
	gcc -o src/lexer.o -c src/lexer.c
	@echo 'Finished building target: $@'
	@echo ' '
	
src/parser.o: src/parser.c src/parser.h src/clogo.h src/symbol_table.h src/buildin_commands.h src/error_handling.h src/symbol_table.h src/lexer.h 
	@echo 'Building target: $@'
	@echo 'Invoking: GCC C Compiler'
	gcc -o src/parser.o -c src/parser.c
	@echo 'Finished building target: $@'
	@echo ' '

src/symbol_table.o: src/symbol_table.c src/symbol_table.h src/lexer.h src/buildin_commands.h
	@echo 'Building target: $@'
	@echo 'Invoking: GCC C Compiler'
	gcc -o src/symbol_table.o -c src/symbol_table.c  	
	@echo 'Finished building target: $@'
	@echo ' '

clean:
	-$(RM) $(OBJS) clogo
	-@echo ' '
